xen: credit2: don't let b_avgload go negative.
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 22 Jul 2016 12:04:53 +0000 (14:04 +0200)
committerWei Liu <wei.liu2@citrix.com>
Fri, 22 Jul 2016 12:36:30 +0000 (13:36 +0100)
commitd933b37eb404f27557e3e8468482c8ddaeaee60e
tree0452c8432172c4d883ab955674da9c80299f94f0
parentfcaa19dfac9b6050e87cb192217d748d9290de44
xen: credit2: don't let b_avgload go negative.

The ASSERT() made effective by b5b5876619bd8ec2e
("xen: credit2: fix two s_time_t handling issues
in load balancing") triggers for b_avgload (spotted
by OSSTest).

b_avgload is where we store the prediction of how
the load of a runqueue will look like in the medium
to long term, because of a vcpu being added to or
removed from there.

On vcpu removal, saturate down b_avgload to zero,
as it makes very few sense to predict that the
load of a runqueue will at some point become negative!

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c